<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="catalog" tagdir="/WEB-INF/tags/catalog"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>
<title><fmt:message key="productReviewList.title"/>-${empty	product.title?product.productName:product.title}</title>
<meta name="keywords" content="${not empty product.metaKeyword?product.metaKeyword:product.keywords}" />
<meta name="description" content="${not empty product.metaDescription?product.metaDescription:product.productDescription.shortDescription}" />
	
<div class="position"><fmt:message key="your.position"/><a href="${ctxPath}/index.html"><fmt:message key="menu.main"/></a> &gt; <product:productName product="${product}"/> &gt;<fmt:message key="productReviewList.reviewMsg"/>
</div>
<div class="line10"></div>
<div class="clearfix">
	<div class="main_left">
		<%---------------------------------start:商品信息 -------------------------%>
		<%@ include file="include/shortProductInfo.jspf"%>
		<%---------------------------------end:  商品信息 -------------------------%>
	</div>
	<div class="main_right_content">
		<div class="wrap_04">
			<form method="get" id="productReviewListForm">
				<div class="tab_04">
					<ul class="content clearfix">
						<%---------------------------------start:全部好中差tab -------------------------%>
						<li><a href="<customer:productReviewUrl product="${product}"/>" <c:if test="${empty param.scoreLevel}">class="curr"</c:if> ><fmt:message key="productReviewList.all"/>(${scoreLevelCounts[0]})</a></li>
						<li><a href="<customer:productReviewUrl product="${product}"/>?scoreLevel=1" <c:if test="${not empty param.scoreLevel and param.scoreLevel==1}">class="curr"</c:if>><fmt:message key="productReviewList.positive"/>(${scoreLevelCounts[1]})</a></li>
						<li><a href="<customer:productReviewUrl product="${product}"/>?scoreLevel=0" <c:if test="${not empty param.scoreLevel and param.scoreLevel==0}">class="curr"</c:if>><fmt:message key="productReviewList.neutral"/>(${scoreLevelCounts[2]})</a></li>
						<li><a href="<customer:productReviewUrl product="${product}"/>?scoreLevel=-1" <c:if test="${not empty param.scoreLevel and param.scoreLevel==-1}">class="curr"</c:if>><fmt:message key="productReviewList.negative"/>(${scoreLevelCounts[3]})</a></li>
						<%---------------------------------end: 全部好中差tab -------------------------%>
						
						<%---------------------------------start:排序 -------------------------%>
						<li class="rr">
							<%@ include file="include/productReviewSort.jspf"%>
						</li>
						<%---------------------------------end:  排序 -------------------------%>
					</ul>
				</div>
				<div class="content">
					<div class="review">
						<div class="summary">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<%---------------------------------start:平均分 -------------------------%>
										<td width="27%">
											<fmt:message key="productDetail.productReview.avgScore"/>
											<br />
											<fmt:formatNumber var="score" value="${product.productStat.reviewScore}" pattern="0.0"/>
											<span class="value">${score}</span><br />
											<customer:scoreStar value="${score}"/>
											<span class="point_num">
												<fmt:message key="productDetail.productReview.TotalCount">
													<fmt:param><b>${product.productStat.onShowReviewCount}</b></fmt:param>
												</fmt:message>
											</span>
										</td>
										<%---------------------------------end:  平均分 -------------------------%>
										
										<%---------------------------------start:百分比 -------------------------%>
										<td width="46%" class="top">
											<%@ include file="include/productReviewForScoreSpan.jspf"%>
										</td>
										<%---------------------------------end:  百分比 -------------------------%>
										
										<%---------------------------------start:链接到详细评论页 -------------------------%>
										<td width="27%">
											<a href="#addReviewForm" class="add"><b><fmt:message key="productDetail.productReview.addReview"/></b></a>
											<br/>
										</td>
										<%---------------------------------end:  链接到详细评论页 -------------------------%>
									</tr>
							</table>
						</div>
						<%---------------------------------start:评论列表 -------------------------%>
						<c:forEach items="${productReviewList}" var="productReview">
							<div class="show clearfix">
								<%---------------------------------start:评论人信息 -------------------------%>
								<customer:customerInfo userName="${productReview.reviewUserName}" membership="${(productReview.customer==null)?null:productReview.customer.membership}" area="${productReview.reviewUserArea}"/>
								<%---------------------------------end:  评论人信息 -------------------------%>
								<div class="item">
									<ins></ins>
									<%---------------------------------start:评论主题，分数与实践 -------------------------%>
									<div class="subject clearfix">
										<h3>${productReview.subject}</h3>
										<span class="time"><fmt:formatDate value="${productReview.createTime}" pattern="yyyy-MM-dd HH:mm" /></span>
										<span class="value">
											<span><fmt:message key="productReview.productRank" />：</span>
											<fmt:formatNumber var="score" value="${productReview.score}" pattern="0"/>
											<customer:scoreStar value="${score}"/>
										</span>
									</div>
									<%---------------------------------end:  评论主题，分数与实践 -------------------------%>
									
									<%---------------------------------start:正文 -------------------------%>
									<div class="content">${productReview.message}</div>
									<%---------------------------------end:  正文 -------------------------%>
									<div class="do clearfix">
										<%---------------------------------start:回复评论 -------------------------%>
										<div class="reply">
											<a  class="btn_02" href="javascript:void(0)" id="replyLink_${productReview.productReviewId}">
												<span><fmt:message key="productReviewList.reply.do"/>(${productReview.onShowReplyCount})</span>
											</a>	
										</div>
										<%---------------------------------end:  回复评论 -------------------------%>
										
										<%---------------------------------start:投票 -------------------------%>
										<div class="use">
											<fmt:message key="productReview.reviewIsUseful"/>
											<a class="useful" id="useFul_${productReview.productReviewId}" href="javascript:void(0)"><fmt:message key="productReview.reviewIsUseful.yes"/></a>(<span id="span_usefulCount_${productReview.productReviewId}">${productReview.usefulCount}</span>)
											<a class="unuseful" id="unuseFul_${productReview.productReviewId}" href="javascript:void(0)"><fmt:message key="productReview.reviewIsUseful.no"/></a>(<span id="span_unusefulCount_${productReview.productReviewId}">${productReview.unusefulCount}</span>)
										</div>
										<%---------------------------------end: 投票 -------------------------%>
									</div>
									
									<%---------------------------------start:回复表单 -------------------------%>
									<div id="replyDiv_${productReview.productReviewId}">
										<%--@ ajax load file="include/productReviewReply.jsp"--%>
									</div>
									<%---------------------------------end:  回复表单 -------------------------%>
									
									<%---------------------------------start:回复列表 -------------------------%>
									<customer:getProductReviewReplys productReviewId="${productReview.productReviewId}" returnReplyListName="replyList">
										<c:if test="${not empty replyList}">
											<div class="item_reply">
												<c:forEach items="${replyList}" var="reply" varStatus="replyStatus">
													<ul class="clearfix">
														<li class="no"><b>${replyStatus.index+1}</b><fmt:message key="productReviewList.floor"/></li>
														<li class="item_reply_txt">
															<dl>
																<dt><b>${reply.reviewUserName}</b><fmt:message key="productDetail.productReview.reviewUserSay"/>：</dt>
																<dd>${reply.message}</dd>
															</dl>
														</li>
														<li class="item_reply_date"><fmt:formatDate value="${reply.createTime}" pattern="yyyy-MM-dd HH:mm" /></li>
													</ul>
												</c:forEach>
											</div>
										</c:if>
									</customer:getProductReviewReplys>
									<%---------------------------------end:  回复列表 -------------------------%>
									
								</div>
							</div>	
						</c:forEach>
						<c:if test="${empty productReviewList}">
							<div class="others_info">
								<fmt:message key="productReviewList.noReview"/>,
								<a href="#addReviewForm"><fmt:message key="productReviewList.addReviewRightNow"/></a>
							</div>
						</c:if>
						<%---------------------------------end:  评论列表 -------------------------%>
					
						<%--------保存查询条件 -------%>
						<%@include file="include/productReviewSearchCriteriaStorage.jspf"%>
						<div class="page_bottom clearfix">
							<paging:linkPagingBottom/>
						</div>
					</div>
				</div>
			</form>
			
			<%---------------------------------start:发表评论表单 -------------------------%>
			<%@ include file="productReviewForm.jsp"%>
			<%---------------------------------end:  发表评论表单 -------------------------%>
		</div>
	</div>
</div>


<c:set var="plugin_highlight" value="true" scope="request"/>
<c:set var="plugin_rating" value="true" scope="request"/>
<c:set var="probizJs_validation" value="true" scope="request"/>	
<c:set var="probizJs_loginDlg" value="true" scope="request"/>
<c:set var="probizJs_shoppingcart" value="true" scope="request"/>
<c:set var="probizJs_productReview" value="true" scope="request"/>
<script type="text/javascript">
$j(document).ready(function () {
	<%--start:获取权限设定 --%>
	reviewRight = '${appConfig.customerReviewRight}';	
	reviewReplyRight = '${appConfig.customerReviewReplyRight}';	
	reviewProductId = ${product.productId};	
	<%--end:  获取权限设定 --%>	
	<c:forEach items="${productReviewList}" var="productReview">
		$j('#useFul_'+${productReview.productReviewId}).bind('click',{"productReviewId":${productReview.productReviewId},"chosen":1},reviewVote);
		$j('#unuseFul_'+${productReview.productReviewId}).bind('click',{"productReviewId":${productReview.productReviewId},"chosen":0},reviewVote);
		$j('#replyLink_'+${productReview.productReviewId}).bind('click',{"productReviewId":${productReview.productReviewId},"chosen":0},showReplyForm);
	</c:forEach>
	<%--start:登录检查 --%>	
	$j('#customerName,#subject,#message').bind('click',reviewRightCheck);
	<%--end:  登录检查 --%>	
	<%--start:评分star --%>	
	$j('.hover-star').rating({
		required:true,
  		focus: function(value, link){
		    var tip = $j('#hover-info');
		    tip.html(link.title);
		},
		blur: function(value, link){
		    var tip = $j('#hover-info');
		    $j('#hover-info').html(tip[0].data || '');
  		},   
  		callback: function(value, link){
  			reviewRightCheck();
		    var tip = $j('#hover-info');
		    tip[0].data = link.title;
		    $j('#score').val(value);
  		}    
	});
	<%--end:评分star --%>	
});
</script>